<?php 
//验证码随机数
function buildRandomString($type=1,$length=4){
	if($type==1){
		$chars=join("",range(0,9));
	}elseif($type=2){
		$chars=join("",array_merge(range(0,9),range("a","z")));
	}
	if($length>strlen($chars)){
		exit("字符串长度不够");
	}
	$chars=str_shuffle($chars);
	return substr($chars,0,$length);
}
//生成唯一字符串
function getUniName(){
	return md5(uniqid(microtime(true),true));
}
//得到文件扩展名
function getExt($name){
	return strtolower(end(explode(".",$name)));
}
?>